package com.jstyle.beatecg.activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.WindowManager;
import com.jstyle.beatecg.R;
import com.jstyle.beatecg.view.EcgDashboardView;
import java.util.concurrent.TimeUnit;
import butterknife.BindView;
import butterknife.ButterKnife;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;

public class HeartHistoryActivity extends AppCompatActivity {

    @BindView(R.id.EcgDashboardView)
    EcgDashboardView EcgDashboardView;
    private static final String TAG = "HeartHistoryActivity";
    private float data=100;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_ecg_watch);
        ButterKnife.bind(this);
        Observable.intervalRange(0,180,0, 200, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<Long>() {


            @Override
            public void onError(Throwable e) {
                Log.i(TAG, "onError: "+e.getMessage());
            }

            @Override
            public void onComplete() {

            }

            @Override
            public void onSubscribe(Disposable d) {

            }

            @Override
            public void onNext(Long aLong) {
              //  data++;
                EcgDashboardView.updateData(data);

            }
        });
    }
}
